<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Func() - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The Func function retrieves a reference to a function." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>Func() <span class="ver">[v1.1.00+]</span></h1>

<p>Retrieves a reference to a function.</p>

<pre class="Syntax">FunctionReference := <span class="func">Func</span>(FunctionName)</pre>
<h2>Parameters</h2>
<dl>

  <dt>FunctionName</dt>
  <dd><p>The name of the function whose reference is retrieved. <em>FunctionName</em> must exist explicitly in the script.</p></dd>

</dl>

<h2>Return Value</h2>
<p>This function returns a <a href="../Objects.htm#Function_References">reference to <em>FunctionName</em></a>. If <em>FunctionName</em> does not exist explicitly in the script (by means such as <a href="_Include.htm">#Include</a> or a non-dynamic call to a <a href="../Functions.htm#lib">library function</a>), it returns 0.</p>

<h2>Remarks</h2>
<p>This function can be used to call the function or retrieve <a href="../objects/Func.htm">information</a> such as the minimum and maximum number of parameters.</p>

<h2>Related</h2>
<p><a href="../Objects.htm#Function_References">Function References</a>, <a href="../objects/Func.htm">Func Object</a></p>
<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre><em>; Retrieve a reference to the function named "StrLen".</em>
fn := Func("StrLen")

<em>; Display information about the function.</em>
MsgBox % fn.Name "() is " (fn.IsBuiltIn ? "built-in." : "user-defined.")</pre>
</div>

</body>
</html>
